/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Tanks;

import com.golden.gamedev.object.AnimatedSprite;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;


/**
 *
 * @author FRNeK
 */
public class Pocisk extends AnimatedSprite{
    private int _startX,_startY;
    String _direction;
    int _horSpeed,_verSpeed;
    protected double _speed;
    protected long _l;
    
    public Pocisk (BufferedImage[] obraz,String direction, int startX,int startY)
    {
        super(obraz,startX,startY);
        _direction=direction;
        _l=1;
        _speed=0.5;
        switch (direction)
        {
            case "up":
                _horSpeed=0;
                _verSpeed=-1;
                this.setAnimationFrame(1, 1);
                this.setAnimate(true);
                break;
            case "down":
                _horSpeed=0;
                _verSpeed=1;
                this.setAnimationFrame(2, 2);
                this.setAnimate(true);
                break;
            case "left":
                _horSpeed=-1;
                _verSpeed=0;
                this.setAnimationFrame(3, 3);
                this.setAnimate(true);
                break;
            case "right":
                _horSpeed=1;
                _verSpeed=0;
                this.setAnimationFrame(0, 0);
                this.setAnimate(true);
                break;                                                
                                                
        }
    }
    
    @Override
     public void update(long _l) 
     {
        super.update(_l);
        //if (this.getX()<=600)
         {
            this.move(_speed*_l*_horSpeed, _speed*_l*_verSpeed);
         }
     }
    
    @Override
    public void move(double d, double d1) 
    {
        super.move(d, d1);
    }
    
    @Override
    public void render(Graphics2D gd) 
    {
        super.render(gd);
    }
}
